
function getSelected(object, ovalue) {
	var i;
	for (i = 0; i < object.length; i++) {
		if (object[i].value == ovalue) {
			object[i].selected = true;
		}
	}
}


function preReturn() {
	history.go(-1);
}

//qu chu kong ge
function isTrim(string) {
  if((string.replace(/\s/g,"").length<string.length)||(string.replace(/\s/g,"").length<1)){
     return false;
  }
    return true;
 } 
 
function trim(string){
   return string.replace(/\s/g,"");
 }

function isEmail(email){
     var emailtest=/^[a-z]([a-z0-9\.]*[-_]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?$/i;
     if(emailtest.test(email)){
	   return true;
     }else{
	   return false;
     }
}

function isUrl(url){
     var urltest="^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$";
     var re=new RegExp(urltest);
     if(re.test(url)){
	   return true;
     }else{
	   return false;
     }
}

function isIP(ip)  
{  
   var re=/(\d+)\.(\d+)\.(\d+)\.(\d+)/g;
   if(re.test(ip))  
   {  
     return true;
   }  
   else  
   {  
   return false; 
   }  
}  


function isPassword(password){
 
   var regu = "^[0-9a-zA-Z]+$"; 
   var re = new RegExp(regu); 
   if (re.test(password)) { 
   return true; 
   }else{ 
    return false; 
   } 
} 

//int
function isInt(num){
 
   var regu = "^-?\\d+$"; 
   var re = new RegExp(regu); 
   if (re.test(num)) { 
   return true; 
   }else{ 
    return false; 
   } 
} 

//+int and 0
function isZore(num){
 
   var regu ="^\\d+$";
   var re = new RegExp(regu); 
   if (re.test(num)) { 
   return true; 
   }else{ 
    return false; 
   } 
} 

//+int
function isOne(num){
 
   var regu ="^[0-9]*[1-9][0-9]*$";
   var re = new RegExp(regu); 
   if (re.test(num)) { 
   return true; 
   }else{ 
    return false; 
   } 
} 